<!DOCTYPE html>
<html class="no-js" lang="zh_CN">

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1">

    <title>${system_admin_title}</title>
    #required_css
</head>

<body>#loading
<div class="app $!layout">
    <!-- 头部菜单 -->
    #header
    <section class="layout">
        <!-- 菜单 -->
        #sidebar
        <!-- 内容主体 -->
        <section class="container">
            <section class="main-content">
                <!-- 主体操作栏 -->
                <header class="header navbar">
                    <!-- 左按钮区 -->
                    <div class="btn-group tool-button">
                        <a class="btn btn-primary navbar-btn" href="${action}"><i class="ti-angle-left"></i> 返回</a>
                    </div>
                </header>
                <div class="content-wrap">
                    <div class="wrapper pt20">
                        <form id="${classNameLower}EditForm" role="form" class="parsley-form" data-parsley-validate action="${action}/edit/do" method="post">
                            <input type="hidden" name="id" value="$!${classNameLower}.id"/>
                            #foreach($!column in $!columns.entrySet())
                            #set($v = $!column.value)
                            #if($!v.get("primary") == false)
                            <div class="row">
                                <div class="col-lg-12">
                                    <div class="form-group">
                                        <label class="control-label">${v.get("displayName")}</label>
                                        #set($k = "_!"+${classNameLower}+"."+${v.get("lowerName")})
                                        <input type="text" class="form-control" name="${v.get('lowerName')}"
                                               value="$!k.replace('_','$')" #if($v.get("nullable") ==
                                        false)data-parsley-required="true"#end placeholder="${v.get('displayName')}">
                                    </div>
                                </div>
                            </div>
                            #if($!velocityCount != $!columns.size())
                            <div class="hr-line-dashed"></div>
                            #end
                            #end
                            #end
                            <div class="row">
                                <div class="col-lg-12 col-md-12 col-sm-12">
                                    <div class="hr-line-dashed"></div>
                                    <div class="form-group text-center">
                                        <div>
                                            <button class="btn btn-primary btn-form-submit btn-parsley"
                                                    data-loading-text="正在提交...">立即提交
                                            </button>
                                            <button type="reset" class="btn btn-default btn-outline">重置</button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
                <a class="exit-offscreen"></a>
            </section>
        </section>
    </section>
</div>
#required_js
<script type="text/javascript">
    ns.requireJS("/framework/js/form/form.js");
    ns.requireJS("/framework/js/view/toast.js");
    ns.requireJS("/framework/js/form/validator.js");
    $(function () {
        $("#${classNameLower}EditForm").ajaxForm({
            beforeSubmit: function (arr, $form, options) {
                //表单特殊验证
                $form.find("button:submit").button("loading");
            },
            success: function (data, statusText, xhr, $form) {
                if (data.success == true) {
                    //修改成功
                    ns.tip.toast.success("修改成功！");
                } else {
                    ns.tip.toast.error(data.message);
                }
                $form.find("button:submit").button("reset");
            }
        });
    });

</script>
#loading_close
</body>
</html>
